/**
 * @param {number[]} nums
 * @return {number}
 */
var missingNumber = function(nums) {
  for (let i = 0; i <= nums.length; i++) {
    if (nums.indexOf(i) === -1) return i
  }
}

console.log(missingNumber([8, 6, 4, 2, 3, 5, 7, 0, 1]))
